Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
zipkin-transport-http
Advanced tools
This is a module that sends Zipkin trace data to a configurable HTTP endpoint.
npm install zipkin-transport-http --save
const {
Tracer,
BatchRecorder,
jsonEncoder: {JSON_V2}
} = require('zipkin');
const {HttpLogger} = require('zipkin-transport-http');
const noop = require('noop-logger');
const recorder = new BatchRecorder({
logger: new HttpLogger({
endpoint: 'http://localhost:9411/api/v2/spans', // Required
jsonEncoder: JSON_V2, // JSON encoder to use. Optional (defaults to JSON_V1)
httpInterval: 1000, // How often to sync spans. Optional (defaults to 1000)
headers: {'Authorization': 'secret'}, // Custom HTTP headers. Optional
timeout: 1000, // Timeout for HTTP Post. Optional (defaults to 0)
maxPayloadSize: 0, // Max payload size for zipkin span. Optional (defaults to 0)
agent: new http.Agent({keepAlive: true}), // Agent used for network related options. Optional (defaults to null)
log: noop, // Logger to use. Optional (defaults to console)
fetchImplementation: require('node-fetch') // Pluggable fetch implementation (defaults to global fetch or fallsback to node fetch)
})
});
const tracer = new Tracer({
recorder,
ctxImpl, // this would typically be a CLSContext or ExplicitContext
localServiceName: 'service-a' // name of this application
});
// Example using a self-signed CA, along with cert/key for mTLS.
new HttpLogger({
endpoint: 'http://localhost:9411/api/v2/spans',
agent: new http.Agent({
ca: fs.readFileSync('pathToCaCert'),
cert: fs.readFileSync('pathToCert'),
key: fs.readFileSync('pathToPrivateKey')
})
})
'Content-Type': 'application/json'
at a minimumDefaults to default global fetch or fallsback to node-fetch
.
A different fetch implementation can be plugged to fulfill different requirements, for example one can use fetch-retry to allow retries and exponential back-off:
const {HttpLogger} = require('zipkin-transport-http');
const fetch = require('node-fetch');
const fetchRetryBuilder = require('fetch-retry');
const fetchRetryOptions = {
// retry on any network error, or > 408 or 5xx status codes
retryOn: (attempt, error, response) => error !== null
|| response == null
|| response.status >= 408,
retryDelay: tryIndex => 1000 ** tryIndex // with an exponentially growing backoff
};
const fetchImplementation = fetchRetryBuilder(fetch, fetchRetryOptions);
const httpLogger = new HttpLogger({
endpoint: `http://localhost:9411/api/v1/spans`,
httpInterval: 1,
fetchImplementation
});
FAQs
Transports Zipkin trace data via HTTP
The npm package zipkin-transport-http receives a total of 24,751 weekly downloads. As such, zipkin-transport-http popularity was classified as popular.
We found that zipkin-transport-http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.